<template>
  <div>
    <!-- <button @click="add">点我加上1</button>
      <span>{{count}}</span>
    <button @click="odd">点我减去1</button> -->
      <!-- 三级联动全局组件：三级联动已注册为全局组件，因此不需要再引入 -->
      <TypeNav/>
      <ListContainer/>
      <TodayRecommend/>
      <Rank/>
      <Like/>
      <Floor v-for="(floor,index) in floorList" :key="floor.id" :list="floor"/>
      <Brand/>
  </div>
</template>

<script>
import ListContainer from './ListContainer'
import TodayRecommend from './TodayRecommend'
import Rank from './Rank'
import Like from './Like'
import Floor from './Floor'
import Brand from './Brand'
import {mapState} from 'vuex'
export default {
name:"Home",
components:{
  ListContainer,TodayRecommend,Rank,Like,Floor,Brand
},
computed:{
  // ...mapState('home',['count'])
},
methods: {
  // add(){
  //   // 派发action
  //   this.$store.dispatch('add')
  // }
},
 mounted() {
        // 派发action
        this.$store.dispatch('getFloorList')
        // 获取用户信息在首页展示
        // this.$store.dispatch('getUserInfo')
    },
    computed:{
        ...mapState({
            floorList:(state)=>{
                return state.home.floorList
            }
        })
    }
}
</script>

<style>

</style>